home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_02_06 / tp55.src < prev    next >
Text File  |  1990-11-04  |  53KB  |  2,483 lines

  1. ;=============================================================================
  2. ;=============================================================================
  3. ;
  4. ;                Macro Library for Turbo Pascal v5.5
  5. ;
  6. ;   Writen by Clark A. Calkins,
  7. ;             C. C. Software
  8. ;             1907 Alvarado Ave.
  9. ;             Walnut Creek, CA 94596
  10. ;
  11. ;             circa September 1990
  12. ;
  13. ;   This file may be freely copied and used for non-commercial purposes.
  14. ;   Intended for use with the Masterful Disassembler (MD86) version 2.3 or
  15. ;   later. This file should be compiled with MD86MAC v1.3 or later. No
  16. ;   compiler error or warning messages should be generated.
  17. ;
  18. ;   There are no known coding errors in these macros but no guarantees are
  19. ;   implied.
  20. ;
  21. ;=============================================================================
  22. ;=============================================================================
  23. ;
  24. ;=============================================================================
  25. ;   String processing macros.
  26. ;=============================================================================
  27. ;
  28. ;   =====>>> String write macros.
  29. ;
  30. ;
  31. ;   Macro to write out the first string constant w/o format.
  32. ;
  33. macroname = WrtStrCnstF
  34.   size    = 10
  35.   mask    = $ff,$00,$00,$ff,$ff,$ff,$00,$00,$ff,$ff,$ff,$ff,$ff,$ff
  36.   compare = $bf,$00,$00,$1e,$57,$bf,$00,$00,$0e,$57,$31,$c0,$50,$9a
  37.   flags   = call
  38.   comment = Write first string constant.
  39. ;
  40. ;   Verify call destination.
  41. ;
  42.   argument
  43.     rbyte = 14
  44.     type = faraddress
  45.     name = WrtItem
  46.   endargument
  47. ;
  48. ;   Get address if FCB.
  49. ;
  50.   argument
  51.     rbyte = 1
  52.     type  = address
  53.     segment = ds
  54.   endargument
  55. ;
  56. ;   Get address of string constant.
  57. ;
  58.   argument
  59.     rbyte = 6
  60.     type  = address
  61.     segment = cs
  62.   endargument
  63. endmacro
  64. ;
  65. ;   Macro to write out a string constant w/o format.
  66. ;
  67. macroname = WrtStrCnst
  68.   size    = 7
  69.   mask    = $ff,$00,$00,$ff,$ff,$ff,$ff,$ff,$ff
  70.   compare = $bf,$00,$00,$0e,$57,$31,$c0,$50,$9a
  71.   flags   = call
  72.   comment = Write string constant.
  73. ;
  74. ;   Verify call destination.
  75. ;
  76.   argument
  77.     rbyte = 9
  78.     type = faraddress
  79.     name = WrtItem
  80.   endargument
  81. ;
  82. ;   Get address of string constant.
  83. ;
  84.   argument
  85.     rbyte = 1
  86.     type  = address
  87.     segment = cs
  88.   endargument
  89. endmacro
  90. ;
  91. ;   Macro to write out the first string variable w/o format.
  92. ;
  93. macroname = WrtStrVarF
  94.   size    = 10
  95.   mask    = $ff,$00,$00,$ff,$ff,$ff,$00,$00,$ff,$ff,$ff,$ff,$ff,$ff
  96.   compare = $bf,$00,$00,$1e,$57,$bf,$00,$00,$1e,$57,$31,$c0,$50,$9a
  97.   flags   = call
  98.   comment = Write first string var.
  99. ;
  100. ;   Verify call destination.
  101. ;
  102.   argument
  103.     rbyte = 14
  104.     type = faraddress
  105.     name = WrtItem
  106.   endargument
  107. ;
  108. ;   Get address if FCB.
  109. ;
  110.   argument
  111.     rbyte = 1
  112.     type  = address
  113.     segment = ds
  114.   endargument
  115. ;
  116. ;   Get address of string constant.
  117. ;
  118.   argument
  119.     rbyte = 6
  120.     type  = address
  121.     segment = ds
  122.   endargument
  123. endmacro
  124. ;
  125. ;   Macro to write out another string variable w/o format.
  126. ;
  127. macroname = WrtStrVar
  128.   size    = 7
  129.   mask    = $ff,$00,$00,$ff,$ff,$ff,$ff,$ff,$ff
  130.   compare = $bf,$00,$00,$1e,$57,$31,$c0,$50,$9a
  131.   flags   = call
  132.   comment = Write string var.
  133. ;
  134. ;   Verify call destination.
  135. ;
  136.   argument
  137.     rbyte = 9
  138.     type = faraddress
  139.     name = WrtItem
  140.   endargument
  141. ;
  142. ;   Get address of string constant.
  143. ;
  144.   argument
  145.     rbyte = 1
  146.     type  = address
  147.     segment = ds
  148.   endargument
  149. endmacro
  150. ;
  151. ;   Macro to check the results of previous I/O.
  152. ;
  153. macroname = CheckIO_Result
  154.   size    = 2
  155.   mask    = $ff,$00,$00,$00,$00,$ff
  156.   compare = $9a,$00,$00,$00,$00,$9a
  157.   flags   = call
  158.   argument
  159.     rbyte = 1
  160.     type  = faraddress
  161.     name  = IO_end
  162.   endargument
  163.   argument
  164.     rbyte = 6
  165.     type  = faraddress
  166.     name  = Check_IO
  167.   endargument
  168. endmacro
  169. ;
  170. ;   Macro to end a line and check I/O result.
  171. ;
  172. macroname = EndLine_CheckIO
  173.   size    = 2
  174.   mask    = $ff,$00,$00,$00,$00,$ff
  175.   compare = $9a,$00,$00,$00,$00,$9a
  176.   flags   = call
  177.   comment = End line and check IOResult.
  178.   argument
  179.     rbyte = 1
  180.     type  = faraddress
  181.     name  = Line_end
  182.   endargument
  183.   argument
  184.     rbyte = 6
  185.     type  = faraddress
  186.     name  = Check_IO
  187.   endargument
  188. endmacro
  189. ;
  190. ;   =====>>> Macros for reading in string variables.
  191. ;
  192. macroname = ReadLine_CheckIO
  193.   size    = 2
  194.   mask    = $ff,$00,$00,$00,$00,$ff
  195.   compare = $9a,$00,$00,$00,$00,$9a
  196.   flags   = call
  197.   comment = Read to EOL, check IOResult.
  198.   argument
  199.     rbyte = 1
  200.     type  = faraddress
  201.     name  = Get_EOL
  202.   endargument
  203.   argument
  204.     rbyte = 6
  205.     type  = faraddress
  206.     name  = Check_IO
  207.   endargument
  208. endmacro
  209. ;
  210. ;   Read a string as the first item in a list.
  211. ;
  212. macroname = ReadStrF
  213.   size    = 9
  214.   mask    = $ff,$00,$00,$ff,$ff
  215.   mask    = $ff,$00,$00,$ff,$ff,$ff,$00,$00,$ff,$ff
  216.   compare = $bf,$00,$00,$1e,$57
  217.   compare = $bf,$00,$00,$1e,$57,$b8,$00,$00,$50,$9a
  218.   flags   = call,perm
  219.   comment = "read str (file, var, len)."
  220.   argument
  221.     rbyte = 15
  222.     type  = faraddress
  223.     name  = RdStrItm
  224.   endargument
  225.   argument
  226.     rbyte = 1
  227.     type  = address
  228.     segment = ds
  229.   endargument
  230.   argument
  231.     rbyte = 6
  232.     type  = address
  233.     segment = ds
  234.   endargument
  235.   argument
  236.     rbyte = 11
  237.     type  = word
  238.   endargument
  239. endmacro
  240. ;
  241. ;   Read the next item as a string.
  242. ;
  243. macroname = ReadStr
  244.   size    = 6
  245.   mask    = $ff,$00,$00,$ff,$ff,$ff,$00,$00,$ff,$ff
  246.   compare = $bf,$00,$00,$1e,$57,$b8,$00,$00,$50,$9a
  247.   flags   = call,perm
  248.   comment = "read string (var, len)."
  249.  argument
  250.     rbyte = 10
  251.     type  = faraddress
  252.     name  = RdStrItm
  253.   endargument
  254.   argument
  255.     rbyte = 1
  256.     type  = address
  257.     segment = ds
  258.   endargument
  259.   argument
  260.     rbyte = 6
  261.     type  = word
  262.   endargument
  263. endmacro
  264. ;
  265. ;=============================================================================
  266. ;   =====>>> String assignment and COPY macros.
  267. ;=============================================================================
  268. ;
  269. ;
  270. ;   Macro to assign a simple string constant to a string variable.
  271. ;
  272. ;     --> StrConstAssign source, destination, max_length
  273. ;
  274. macroname = StrConstAssign
  275.   size    = 9
  276.   mask    = $ff,$00,$00,$ff,$ff,$ff,$00,$00,$ff,$ff
  277.   mask    = $ff,$00,$00,$ff,$ff
  278.   compare = $bf,$00,$00,$0e,$57,$bf,$00,$00,$1e,$57
  279.   compare = $b8,$00,$00,$50,$9a
  280.   flags   = call,perm
  281. ;
  282. ;   This pseudo argument is used to verify that the call instruction has the
  283. ;   desired destination address. Its name (StrMove) must already be in place.
  284. ;
  285.   argument
  286.     rbyte = 15
  287.     type  = faraddress
  288.     name  = StrMove
  289.   endargument
  290. ;
  291. ;   First real argument is the address of the source string constant. This is a
  292. ;   CS: relative offset too.
  293. ;
  294.   argument
  295.     rbyte = 1
  296.     type  = address
  297.     segment = cs
  298.   endargument
  299. ;
  300. ;   Second argument is the address of the destination string variable. This is
  301. ;   a DS: relative offset (we must declare this or CS {from above} will be
  302. ;   used).
  303. ;
  304.   argument
  305.     rbyte = 6
  306.     type  = address
  307.     segment = ds
  308.   endargument
  309.  ;
  310.  ;   The last argument is the max length of the destination string. This will
  311.  ;   be used to truncate the string if necessary.
  312.  ;
  313.   argument
  314.     rbyte = 11
  315.     type  = word
  316.   endargument
  317. endmacro
  318. ;
  319. ;   Macro to concatinate a string constant to the back of a string variable.
  320. ;
  321. ;     --> ConcatStrConst temp_level,source_str, str_constant
  322. ;
  323. macroname = ConcatStrConst
  324.   size    = 12
  325.   mask    = $ff,$ff,$ff,$00,$ff,$ff,$ff,$00,$00,$ff,$ff,$ff,$00,$00,$00,$00
  326.   compare = $8d,$be,$00,$00,$16,$57,$bf,$00,$00,$1e,$57,$9a,$00,$00,$00,$00
  327.   mask    = $ff,$00,$00,$ff,$ff,$ff
  328.   compare = $bf,$00,$00,$0e,$57,$9a
  329.   flags   = call,perm
  330. ;
  331. ;   Verify destination address of all calls.
  332. ;
  333.   argument
  334.     rbyte = 12
  335.     type  = faraddress
  336.     name  = StrStore
  337.   endargument
  338.   argument
  339.     rbyte = 22
  340.     type  = faraddress
  341.     name  = StrAdd
  342.   endargument
  343. ;
  344. ;   First argument is the level indicator (which temp variable to use).
  345. ;
  346.   argument
  347.     rbyte = 2
  348.     type  = word
  349.   endargument
  350. ;